home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / ui_fileP.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  18.4 KB  |  695 lines

  1. /*****************************************************************************
  2.   FILE           : ui_fileP.c
  3.   SHORTNAME      : fileP.c
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        :
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Tilman Sommer
  10.   DATE           : 22.5.1990
  11.  
  12.   CHANGED BY     : Michael Vogt, Guenter Mamier
  13.   IDENTIFICATION : @(#)ui_fileP.c    1.16 4/18/94
  14.   SCCS VERSION   : 1.16 
  15.   LAST CHANGE    : 4/18/94  
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.              
  19. ******************************************************************************/
  20.  
  21.  
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25.  
  26. #include "ui.h"
  27.  
  28. #include "kr_ui.h"
  29.  
  30. #include "d3_main.h"
  31. #include "d3_global.h"
  32. #include "d3_draw.h"
  33.  
  34. #include "o_graph.h"
  35.  
  36. #include "ui_infoP.h"
  37. #include "ui_confirmer.h"
  38. #include "ui_textP.h"
  39. #include "ui_status.h"
  40. #include "ui_display.h"
  41. #include "ui_remoteP.h"
  42. #include "ui_utilP.h"
  43. #include "ui_netUpdate.h"
  44. #include "ui_selection.h"
  45. #include "ui_result.h"
  46. #include "ui_config.h"
  47. #include "ui_mainP.h"
  48. #include "ui_inversion.h"
  49. #include "ui_remote.h"
  50. #include "ui_main.h"
  51. #include "ui_event.h"
  52. #include "ui_action.h"
  53.  
  54. #include "ui_fileP.ph"
  55.  
  56.  
  57. /*****************************************************************************
  58.   FUNCTION : ui_getExtension
  59.  
  60.   PURPOSE  : returns the extension of the specified fil type
  61.   RETURNS  : char *
  62.   NOTES    :
  63.  
  64.   UPDATE   : 20.8.1990
  65. ******************************************************************************/
  66.  
  67. char *ui_getExtension (FlagType fileType)
  68.  
  69. {
  70.     switch (fileType) {
  71.       case UI_FILE_TXT: return(".txt"); break;
  72.       case UI_FILE_PAT: return(".pat"); break;
  73.       case UI_FILE_RES: return(".res"); break;
  74.       case UI_FILE_NET: return(".net"); break;
  75.       case UI_FILE_CFG: return(".cfg"); break;
  76.       default: return(""); break;
  77.     }
  78. }
  79.       
  80.  
  81. /*****************************************************************************
  82.   FUNCTION : ui_fileExist
  83.  
  84.   PURPOSE  : Checks, wheter there is a named file with the right extension.
  85.   RETURNS  : Bool
  86.   NOTES    :
  87.  
  88.   UPDATE   : 20.8.1990
  89. ******************************************************************************/
  90.  
  91. Bool ui_fileExist(char filename[], FlagType fileType)
  92.  
  93. {
  94.     FILE   *filePtr;
  95.     char   buf[80+MAX_NAME_LENGTH];
  96.  
  97.     if (fileType)
  98.     if (strlen(filename) AND (filename[0] == '/'))
  99.         sprintf(buf, "%s%s", filename, ui_getExtension(fileType));
  100.     else
  101.         sprintf(buf, "%s/%s%s", ui_pathname, 
  102.             filename, ui_getExtension(fileType));
  103.     else
  104.     sprintf(buf, "%s", filename);
  105.  
  106.     if ((filePtr = fopen(buf,"r")) != NULL) 
  107.     fclose(filePtr);
  108.     return(filePtr != NULL);
  109. }
  110.  
  111.  
  112. /*****************************************************************************
  113.   FUNCTION : ui_file_updateShellLabels
  114.  
  115.   PURPOSE  : display the name of the last net-file in the baseFrame label.
  116.              This filename is stored in the variable filenameNet. Call
  117.          this routine only, if it is sure, that filename holds the
  118.          name of a net-file!
  119.   RETURNS  : void
  120.   NOTES    :
  121.  
  122.   UPDATE   :
  123. *****************************************************************************/
  124.  
  125. void ui_file_updateShellLabels (void)
  126.  
  127. {
  128.     char    buf[MAX_NAME_LENGTH + 40];
  129.  
  130.     if (ui_remoteIsCreated) {
  131.     sprintf(buf,"snns-remote    pattern: %s", ui_filenamePAT);
  132.     XStoreName(ui_display, XtWindow(ui_popRemote), buf);
  133.     }
  134.     if (ui_infoIsCreated) {
  135.     sprintf(buf,"snns-info    net: %s", ui_filenameNET);
  136.     XStoreName(ui_display, XtWindow(ui_toplevel), buf);
  137.     }
  138. }
  139.  
  140.  
  141. /*****************************************************************************
  142.   FUNCTION : ui_file_saveText
  143.  
  144.   PURPOSE  : saves the contents of the text window
  145.   RETURNS  : void
  146.   NOTES    :
  147.  
  148.   UPDATE   :
  149. *****************************************************************************/
  150.  
  151. void ui_file_saveText (Widget w, XtPointer button, caddr_t call_data)
  152.  
  153. {
  154.     Bool performSave = TRUE;
  155.  
  156.     /* examine the filename */
  157.  
  158.     if (strlen(ui_filenameTXT) == 0) {
  159.     ui_confirmOk("No file specified.");
  160.     ui_printMessage("Save text aborted.");
  161.     return;
  162.     } 
  163.  
  164.     if (ui_fileExist(ui_filenameTXT, UI_FILE_TXT)) {
  165.     performSave = 
  166.         ui_confirmYes("This text file already exists! Overwrite?");
  167.     }
  168.     
  169.     if (performSave) {
  170.     /* ui_tw_saveText(ui_filenameTXT); */
  171.     ui_printMessage("Text saved.");
  172.     } else
  173.     ui_printMessage("Saving text aborted.");
  174. }
  175.  
  176.  
  177. /*****************************************************************************
  178.   FUNCTION : ui_file_loadText
  179.  
  180.   PURPOSE  : saves the contents of the text window
  181.   RETURNS  : void
  182.   NOTES    :
  183.  
  184.   UPDATE   :
  185. *****************************************************************************/
  186.  
  187. void  ui_file_loadText (Widget w, XtPointer button, caddr_t call_data)
  188.  
  189. {
  190.     char string  [80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  191.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  192.  
  193.     /* close old file, if one is open */
  194.     if (ui_textFilePtr != NULL) {
  195.     fclose(ui_textFilePtr);
  196.     ui_textFilePtr = NULL; /* signal: no open text file */
  197.     }
  198.     
  199.     /* examine the filename */
  200.  
  201.     if (strlen(ui_filenameTXT) == 0) {
  202.     ui_confirmOk("No file specified! Reporting on logfile is off now.");
  203.     return;
  204.     }
  205.  
  206.     /* a filename is given */
  207.  
  208.     if (ui_filenameTXT[0] == '/')
  209.     sprintf(filename, "%s%s", ui_filenameTXT, ui_getExtension(UI_FILE_TXT));
  210.     else
  211.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameTXT, 
  212.         ui_getExtension(UI_FILE_TXT));
  213.  
  214.     if (NOT ui_fileExist(filename, 0)) { 
  215.     /* new text file */
  216.     ui_textFilePtr = fopen(filename,"a");
  217.     } else {
  218.     /* a old file exists */
  219.     if (ui_confirmYes("Logfile already exist. Append?"))
  220.         ui_textFilePtr = fopen(filename,"a");
  221.     else
  222.         ui_textFilePtr = fopen(filename,"w");
  223.     }
  224.     sprintf(string, "current logfile:\n   %s\n", filename);
  225.     ui_tw_printMessage(string);
  226. }
  227.  
  228.  
  229. /*****************************************************************************
  230.   FUNCTION : ui_file_saveConfiguration
  231.  
  232.   PURPOSE  : save all configuration data (layer names, displays)
  233.   RETURNS  : void
  234.   NOTES    : 
  235.  
  236.   UPDATE   :
  237. *****************************************************************************/
  238.  
  239. void ui_file_saveConfiguration (Widget w, XtPointer button, caddr_t call_data)
  240.  
  241. {
  242.     char string[80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  243.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  244.     Bool performSave = TRUE;
  245.     FILE *filePtr;
  246.  
  247.     if (strlen(ui_filenameCFG) == 0) {
  248.     ui_confirmOk("No file specified!");
  249.     return;
  250.     }
  251.  
  252.     if (ui_filenameCFG[0] == '/')
  253.     sprintf(filename, "%s%s", ui_filenameCFG, 
  254.         ui_getExtension(UI_FILE_CFG));
  255.     else
  256.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameCFG, 
  257.         ui_getExtension(UI_FILE_CFG));
  258.  
  259.     if (ui_fileExist(filename, 0)) 
  260.     performSave = ui_confirmYes("File already exist! Overwrite?");   
  261.     
  262.     if (performSave) {
  263.     ui_printMessage("Saving configuration ...");
  264.     filePtr = fopen(filename,"w");
  265.     if (filePtr != NULL) {
  266.         if (ui_cfg_save(filePtr) > 0) {
  267.         sprintf(string, "Configuration saved to file:\n   %s\n", filename);
  268.         ui_tw_printMessage(string);
  269.         } else
  270.         ui_confirmOk("Write error! Configuration not saved completely!");
  271.         fclose(filePtr);
  272.     } else
  273.         ui_confirmOk("Error! Configuration not saved!");
  274.     ui_printMessage("");
  275.    } 
  276. }
  277.     
  278.  
  279. /*****************************************************************************
  280.   FUNCTION : ui_file_loadDefaultConfiguration
  281.  
  282.   PURPOSE  : load a configuration
  283.   RETURNS  : void
  284.   NOTES    : 
  285.  
  286.   UPDATE   :
  287. *****************************************************************************/
  288.  
  289. void ui_file_loadDefaultConfiguration (char pathName[])
  290.                  
  291. {
  292.     char string  [80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  293.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  294.     FILE *filePtr;
  295.     int  err;
  296.  
  297.     sprintf(filename,"%s/default.cfg", pathName);
  298.  
  299.     if (NOT ui_fileExist(filename, 0)) { 
  300.     if (getenv("XGUILOADPATH") != NULL) 
  301.         sprintf(filename, "%s/default.cfg", getenv("XGUILOADPATH"));
  302.     if (NOT ui_fileExist(filename,0)) {
  303.         fprintf (stdout, "Can't load <default.cfg>!\n");
  304.         return;
  305.     }
  306.     }
  307.     /* a file exists */
  308.     
  309.     ui_printMessage("Loading configuration ...");
  310.     filePtr = fopen(filename,"r");
  311.     if ((err = ui_cfg_load(filePtr)) > 0) {
  312.     sprintf(string, "Configuration loaded from file:\n   %s\n", filename);
  313.     ui_tw_printMessage(string);
  314.     } else {
  315.     sprintf(string, "Read error in configuration file line %d!", -err);
  316.     ui_confirmOk(string);
  317.     }
  318.     ui_printMessage("");
  319. }
  320.  
  321.  
  322. /*****************************************************************************
  323.   FUNCTION : ui_file_doLoadConfiguration
  324.  
  325.   PURPOSE  : load a configuration
  326.   RETURNS  : void
  327.   NOTES    : this file must exist !!!
  328.  
  329.   UPDATE   :
  330. *****************************************************************************/
  331.  
  332. static void ui_file_doLoadConfiguration (char *filename)
  333.  
  334. {
  335.     char string  [80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  336.     FILE *filePtr;
  337.     int  err;
  338.  
  339.     /* a file exists */
  340.     
  341.     ui_printMessage("Loading configuration ...");
  342.     filePtr = fopen(filename,"r");
  343.     if ((err = ui_cfg_load(filePtr)) > 0) {
  344.     sprintf(string, "Configuration loaded from file:\n   %s\n", filename);
  345.     ui_tw_printMessage(string);
  346.     } else {
  347.     sprintf(string, "Read error in configuration file line %d!", -err);
  348.     ui_confirmOk(string);
  349.     }
  350.     ui_printMessage("");
  351. }
  352.  
  353.  
  354. /*****************************************************************************
  355.   FUNCTION : ui_file_loadConfiguration
  356.  
  357.   PURPOSE  : load a configuration
  358.   RETURNS  : void
  359.   NOTES    : 
  360.  
  361.   UPDATE   :
  362. *****************************************************************************/
  363.  
  364. void ui_file_loadConfiguration (Widget w, XtPointer button, caddr_t call_data)
  365.  
  366. {
  367.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  368.  
  369.     /* check now for errors and react ! */
  370.     if (strlen(ui_filenameCFG) == 0) {
  371.     ui_confirmOk("No file specified !");
  372.     return;
  373.     }
  374.  
  375.     if (ui_filenameCFG[0] == '/')
  376.     sprintf(filename, "%s%s", ui_filenameCFG, ui_getExtension(UI_FILE_CFG));
  377.     else
  378.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameCFG, 
  379.         ui_getExtension(UI_FILE_CFG));
  380.  
  381.     /* a filename is given */
  382.     if (NOT ui_fileExist(filename, 0)) { 
  383.     ui_confirmOk("No such configuration file exists!");
  384.     return;
  385.     }
  386.  
  387.     /* a file exists */
  388.     ui_file_doLoadConfiguration(filename);
  389. }
  390.  
  391.  
  392. /*****************************************************************************
  393.   FUNCTION : ui_file_savePatterns
  394.  
  395.   PURPOSE  : save all patterns in the memory in the specified name 
  396.   RETURNS  : void
  397.   NOTES    : 
  398.  
  399.   UPDATE   :
  400. *****************************************************************************/
  401.  
  402. void ui_file_savePatterns (Widget w, XtPointer button, caddr_t call_data)
  403.  
  404. {
  405.     char string[80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  406.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  407.     Bool performSave = TRUE;
  408.  
  409.     if (strlen(ui_filenamePAT) == 0) {
  410.     ui_confirmOk("No file specified!");
  411.     return;
  412.     }
  413.  
  414.     if (ui_filenamePAT[0] == '/')
  415.     sprintf(filename, "%s%s", ui_filenamePAT, 
  416.         ui_getExtension(UI_FILE_PAT));
  417.     else
  418.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenamePAT, 
  419.         ui_getExtension(UI_FILE_PAT));
  420.  
  421.     if (ui_fileExist(filename, 0)) {
  422.     sprintf(string,"%s already exist! Overwrite?", ui_filenamePAT);
  423.     performSave = ui_confirmYes(string);
  424.     }
  425.     
  426.     if (performSave) {
  427.     ui_printMessage("Saving patterns ...");
  428.     ui_checkError(krui_saveNewPatterns(filename,CURR_PATTERN_SET));
  429.     if (ui_kernelError < 0)
  430.         ui_confirmOk("Error during saving patterns!");
  431.     else {
  432.         sprintf(string, "Patterns saved to file:\n   %s\n", filename);
  433.         ui_tw_printMessage(string);
  434.         strcpy(ui_filenameSLPAT, ui_filenamePAT);
  435.         ui_file_updateShellLabels();
  436.     }
  437.     }
  438. }
  439.     
  440.  
  441. /*****************************************************************************
  442.   FUNCTION : ui_file_loadPatterns
  443.  
  444.   PURPOSE  : load all patterns into memory and display the first
  445.   RETURNS  : void
  446.   NOTES    : 
  447.  
  448.   UPDATE   :
  449. *****************************************************************************/
  450.  
  451. void ui_file_loadPatterns (Widget w, XtPointer button, caddr_t call_data)
  452.  
  453. {
  454.     char string  [80+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  455.     char filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  456.     char filestring[30];
  457.  
  458.     /* check now for errors and react ! */
  459.     if (strlen(ui_filenamePAT) == 0) {
  460.     ui_confirmOk("No file specified !");
  461.     return;
  462.     }
  463.  
  464.     if (ui_filenamePAT[0] == '/')
  465.     sprintf(filename, "%s%s", ui_filenamePAT,ui_getExtension(UI_FILE_PAT));
  466.     else
  467.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenamePAT, 
  468.         ui_getExtension(UI_FILE_PAT));
  469.  
  470.     /* a filename is given */
  471.     if (NOT ui_fileExist(filename, 0)) { 
  472.     ui_confirmOk("No such pattern file exists!");
  473.     return;
  474.     }
  475.     /* a file exists */
  476.     
  477.     ui_printMessage("Loading patterns ...");
  478.     ui_checkError(krui_loadNewPatterns(filename,&CURR_PATTERN_SET));
  479.     if (ui_kernelError < 0) {
  480.     ui_confirmOk("Error during loading patterns!");
  481.     ui_noOfCurrentPattern = 0;
  482.     ui_rem_displayPatternNumber();
  483.     } else {
  484.     ui_noOfCurrentPattern = 1;
  485.     CURR_PATTERN_SET = NO_OF_PATTERN_SETS;
  486.     NO_OF_PATTERN_SETS++;
  487.     PATTERN_SET_FILE[CURR_PATTERN_SET] = 
  488.         (char *)malloc(strlen(filename)+1);
  489.     if(strrchr(filename,'/') == NULL)
  490.         strcpy(filestring,filename);
  491.     else
  492.         strcpy(filestring,strrchr(filename,'/')+1);
  493.     strncpy(PATTERN_SET_FILE[CURR_PATTERN_SET],filestring,
  494.         strlen(filestring)-4);
  495.     PATTERN_SET_FILE[CURR_PATTERN_SET][strlen(filestring)-4] = '\0';
  496.     ui_rem_displayPatternNumber();
  497.     if(ui_remoteIsCreated)ui_rem_updatePattList();
  498.     ui_rem_defSubPat((Widget) button,1,(caddr_t)1);
  499.     sprintf(string, "Patterns loaded from file:\n   %s\n", filename);
  500.     ui_tw_printMessage(string);
  501.     ui_printMessage("Patterns loaded.");
  502.     strcpy(ui_filenameSLPAT, ui_filenamePAT);
  503.     ui_file_updateShellLabels();
  504.     }
  505. }
  506.  
  507.  
  508. /*****************************************************************************
  509.   FUNCTION : ui_file_saveNet
  510.  
  511.   PURPOSE  : save the dynamic net structure via kernal routines
  512.   RETURNS  : void
  513.   NOTES    :
  514.  
  515.   UPDATE   :
  516. *****************************************************************************/
  517.  
  518. void ui_file_saveNet (Widget w, XtPointer button, caddr_t call_data)
  519.  
  520. {
  521.     Bool  performSave = TRUE;
  522.     char  filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  523.  
  524.     if (strlen(ui_filenameNET) == 0) {
  525.     ui_confirmOk("No file specified!");
  526.     return;
  527.     }
  528.  
  529.     if (ui_filenameNET[0] == '/')
  530.     sprintf(filename, "%s%s", ui_filenameNET, 
  531.         ui_getExtension(UI_FILE_NET));
  532.     else
  533.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameNET, 
  534.         ui_getExtension(UI_FILE_NET));
  535.  
  536.     if (ui_fileExist(filename, 0)) 
  537.     performSave =
  538.         ui_confirmYes("This file already exist! Overwrite?");
  539.  
  540.     if (performSave) {
  541.     ui_printMessage("Saving network ...");
  542.     ui_checkError(krui_saveNet(filename, ui_filenameNET));
  543.     if (ui_kernelError < 0)
  544.         ui_confirmOk("Error during saving the network!");
  545.     else {
  546.         char string[40+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  547.         ui_printMessage("Network saved.");
  548.         strcpy(ui_filenameSLNET, ui_filenameNET);
  549.         ui_file_updateShellLabels();
  550.         sprintf(string,"Network saved on file: %s\n",filename);
  551.         ui_tw_printMessage(string);
  552.     }
  553.     }
  554. }
  555.  
  556.  
  557. /*****************************************************************************
  558.   FUNCTION : ui_file_loadNet
  559.  
  560.   PURPOSE  : loads the dynamic net structure
  561.   RETURNS  : void
  562.   NOTES    : calls krui_loadNet() 
  563.  
  564.   UPDATE   :
  565. *****************************************************************************/
  566.  
  567. void ui_file_loadNet (Widget w, XtPointer button, caddr_t call_data)
  568.  
  569. {
  570.     char     filename[4+MAX_NAME_LENGTH+MAX_NAME_LENGTH];
  571.     char     string[MAX_NAME_LENGTH+MAX_NAME_LENGTH + 80]; 
  572.              /* filename plus some text */
  573.     Bool     performLoad = TRUE;
  574.     char     *temp;
  575.  
  576.     /* check now for errors and react ! */
  577.     if (strlen(ui_filenameNET) == 0) { 
  578.     ui_confirmOk("No file specified");
  579.     return;
  580.     }
  581.  
  582.     /* a filename is given */
  583.  
  584.     if (ui_filenameNET[0] == '/')
  585.     sprintf(filename, "%s%s", ui_filenameNET, 
  586.         ui_getExtension(UI_FILE_NET));
  587.     else
  588.     sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameNET, 
  589.         ui_getExtension(UI_FILE_NET));
  590.  
  591.     if (NOT ui_fileExist(filename, 0)) {
  592.     ui_confirmOk("No such network file exists!");
  593.     return;
  594.     }
  595.  
  596.     /* a file exists */
  597.     
  598.     if  (krui_getNoOfUnits() != 0) {
  599.     if (NOT ui_confirmYes("Load will erase current network. Load?"))
  600.         performLoad = FALSE;
  601.     } 
  602.  
  603.     if (INVERS_CREATED) {
  604.        XtDestroyWidget(ui_InvRootWidget);
  605.        INVERS_CREATED = 0;
  606.     }
  607.    
  608.     if (performLoad) {
  609.     sprintf(string,"Loading network: %s ...", filename);
  610.     ui_printMessage(string);
  611.     if(ui_remoteIsCreated)ui_xSetLabel(ui_remoteMessageWidget, "");
  612.         d3_clear_xyTranslationTable ();
  613.     ui_checkError(krui_loadNet(filename, &temp));
  614.     if (ui_kernelError < 0)
  615.         ui_confirmOk("Error during loading the network!");
  616.     else {
  617.         ui_printMessage("Network loaded.");  
  618.         /* message to text window */
  619.         sprintf(string,"\n\n\nNetwork loaded from file:\n   %s\n",
  620.             filename);
  621.         ui_tw_printMessage(string);
  622.  
  623.         /* try to load a configuration file with the same name */
  624.             if (ui_loadCorrespondingCfg) {
  625.                 ui_loadCorrespondingCfg = TRUE;
  626.             sprintf(filename, "%s/%s%s", ui_pathname, ui_filenameNET, 
  627.                 ui_getExtension(UI_FILE_CFG));
  628.             if (ui_fileExist(filename, 0) AND  
  629.             ui_confirmYes("Load corresponding configuration file")) {
  630.             ui_file_doLoadConfiguration(filename);
  631.             }
  632.         }
  633.     }
  634.  
  635.        /* initialization for graph */
  636.         if(o_open){
  637.           o_CurveNo += ((o_CurveLengths[o_CurveNo] != 0) && (o_CurveNo < MAX_CURVE_NO-1)) ? (1) : (0);
  638.           o_InitCurve();
  639.           o_LearnStepCount = 0;
  640.         }
  641.  
  642.     /* reset gui */
  643.     ui_sel_resetList();       /* reset selections */
  644.     ui_net_completeRefresh(ui_currentDisplay, UI_GLOBAL); /* show net */
  645.     ui_printMessage("");
  646.     ui_stat_displayStatus(ui_gridPosMouse);
  647.     strcpy(ui_filenameSLNET, ui_filenameNET);
  648.     ui_file_updateShellLabels();
  649.     ui_info_makeUnitInfoPanelConsistent();
  650.     }    
  651. }
  652.  
  653.  
  654. /*****************************************************************************
  655.   FUNCTION : ui_file_loadResult
  656.  
  657.   PURPOSE  : dummy callback for future use
  658.   RETURNS  : void
  659.   NOTES    : 
  660.  
  661.   UPDATE   :
  662. *****************************************************************************/
  663.  
  664. void ui_file_loadResult (Widget w, XtPointer button, caddr_t call_data)
  665.  
  666. {
  667.     ui_confirmOk("No sense in loading a result file");
  668. }
  669.  
  670.  
  671. /*****************************************************************************
  672.   FUNCTION : ui_file_saveResult
  673.  
  674.   PURPOSE  : create or append result file
  675.   RETURNS  : void
  676.   NOTES    : 
  677.  
  678.   UPDATE   :
  679. *****************************************************************************/
  680.  
  681. void ui_file_saveResult (Widget w, XtPointer button, caddr_t call_data)
  682.  
  683. {
  684.     if (krui_getNoOfPatterns() == 0) 
  685.     {
  686.         ui_confirmOk("No patterns loaded");
  687.         return;
  688.     }
  689.     ui_popupResult(w);
  690. }
  691.  
  692.  
  693. /* end of file */
  694. /* lines: 694 */
  695.